package services

import (
	"context"
	"k8sdev/pkg/client"
	"log"

	v1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func GetPods(namespaceName string) (podList *[]v1.Pod, err error) {
	err = client.NewClient()
	client := client.GetClientSet()
	if err != nil {
		log.Fatal(err.Error())
		return
	}
	list, err := client.CoreV1().Pods(namespaceName).List(context.Background(), metav1.ListOptions{})
	if err != nil {
		log.Fatal(err)
		return
	}
	podList = &list.Items

	return
}
